package com.gjh.controller.stat;

import com.alibaba.dubbo.config.annotation.Reference;
import com.gjh.controller.BeanController;
import com.gjh.service.stat.StatService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping(value = "/stat",name = "统计界面")
public class StatController extends BeanController{
    @Reference
    private StatService statService;


    @RequestMapping(value = "/toCharts",name = "跳转到统计页面")
    public String toCharts(String chartsType){
//        sell factory online
        return "stat/stat-"+chartsType;
    }

    @RequestMapping(value = "/factoryCharts",name = "每个厂家的销售金额统计")
    @ResponseBody
    public List<Map> factoryCharts(){
        List<Map> maps = statService.factoryCharts(getCompanyId());
        return maps;
    }

    @RequestMapping(value = "/sellCharts",name = "每种产品（货物）销售量统计")
    @ResponseBody
    public List<Map> sellCharts(){
        return statService.sellCharts(getCompanyId());
    }

    @RequestMapping(value = "onlineCharts",name = "每小时的访问量")
    @ResponseBody
    public List<Map> onlineCharts(){
        return statService.onlineCharts(getCompanyId());
    }







}
